package cn.outsourcing.supermarket.service.impl;

import cn.outsourcing.supermarket.converter.HiolabsGoodsConverter;
import cn.outsourcing.supermarket.converter.HiolabsOrderGoodsConverter;
import cn.outsourcing.supermarket.po.HiolabsGoods;
import cn.outsourcing.supermarket.po.HiolabsOrderGoods;
import cn.outsourcing.supermarket.mapper.HiolabsOrderGoodsMapper;
import cn.outsourcing.supermarket.service.HiolabsOrderGoodsService;
import cn.outsourcing.supermarket.vo.OrderGoodsVO;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author gzkemays
 * @since 2021-10-14
 */
@Service
public class HiolabsOrderGoodsServiceImpl extends ServiceImpl<HiolabsOrderGoodsMapper, HiolabsOrderGoods> implements HiolabsOrderGoodsService {

    @Resource
    HiolabsOrderGoodsMapper orderGoodsMapper;

    @Override
    public List<OrderGoodsVO> getOrderGoods(Integer orderId) {
        List<HiolabsOrderGoods> list = orderGoodsMapper.selectList(
                Wrappers.<HiolabsOrderGoods>lambdaQuery()
                        .eq(HiolabsOrderGoods::getOrderId, orderId)
                        .eq(HiolabsOrderGoods::getIsDelete, 0));
        return HiolabsOrderGoodsConverter.INSTANCE.convertToOrderGoods(list);
    }
}
